package com.m1book.domain.relation;

import java.io.Serializable;
import java.util.Date;

import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;

import com.m1book.domain.common.Trace;
import com.m1book.domain.user.Miser;

@Document(collection = "invite_trace")
public class InviteTrace extends Trace implements Serializable {
	private static final long serialVersionUID = 3402794831818811373L;
	
	@DBRef(collection = "miser")
	@Indexed
	private final Miser inviter;
	
	@Indexed
	private final String qq;
	
	private final long inviteTime;
	
	@Indexed
	private final String inviteSN;
	
	private String inviteeName;
	
	private Date checkTime;

	public InviteTrace(Miser inviter, String qq, String inviteeName, long inviteTime) {
		this.inviter = inviter;
		this.qq = qq;
		this.inviteTime = inviteTime;
		this.inviteeName = inviteeName;
		inviteSN = inviter.getId() + "-" + qq + "-" + inviteTime;
	}

	public Miser getInviter() {
		return inviter;
	}

	public String getQq() {
		return qq;
	}

	public long getInviteTime() {
		return inviteTime;
	}

	public String getInviteSN() {
		return inviteSN;
	}

	public String getInviteeName() {
		return inviteeName;
	}

	public void setInviteeName(String inviteeName) {
		this.inviteeName = inviteeName;
	}

	public Date getCheckTime() {
		return checkTime;
	}

	public void setCheckTime(Date checkTime) {
		this.checkTime = checkTime;
	}

	@Override
	public String toString() {
		return "InviteTrace [inviterid=" + inviter.getId() + ", qq=" + qq
				+ ", inviteTime=" + inviteTime + "]";
	}

}
